// 1.0 导入vue核心包
import Vue from 'vue';

// 2.0 导入App.vue的vue对象
import App from './App.vue';

// 3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';
// 3.0.1 将vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);

// 3.0.2 导入路由规则对应的组件对象
import home from './components/Home.vue';
import car from './components/shopcar/car.vue';
import member from './components/members/memberList.vue';
import search from './components/search/search.vue';
import news from './components/news/newsList.vue';
import photos from './components/photos/photoList.vue';
import goods from './components/goods/goodsList.vue';
import feedback from './components/feedback/feedback.vue';
import video from './components/video/videos.vue';
import callme from './components/callme/callme.vue';
import newsinfo from './components/news/newsInfo.vue';


// 3.0.2 定义路由规则
var router1 = new vueRouter({
	linkActiveClass:'mui-active',//改变更改路由时添加的类
	routes:[
		{path:'/home',component:home},
		{path:'/car',component:car},
		{path:'/member',component:member},
		{path:'/search',component:search},
		{path:'/news/newsList',component:news},
		{path:'/photos',component:photos},
		{path:'/goods',component:goods},
		{path:'/feedback',component:feedback},
		{path:'/video',component:video},
		{path:'/callme',component:callme},
		{path:'/news/newsinfo/:id',component:newsinfo}
	]
	});


// 4.0 注册mint-ui
// 导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';
// 导入mint-ui组件对象
import mintui from 'mint-ui';
// 在Vue中全局使用mintui
Vue.use(mintui);

// 5.0 注册mui的css样式
import '../statics/mui/css/mui.css';
import '../statics/css/site.css';
// 导入vue-resource对象
import vueResource from 'vue-resource';
import moment from 'moment';
Vue.filter('datefmt',function(input,fmtstring){
	//使用momentjs 实现格式化日期
	return moment(input).format(fmtstring);
});
Vue.use(vueResource);
Vue.http.options.root="http://vue.studyit.io";
// 5.0 利用Vue对象进行解析渲染
new Vue({
	
	el:'#app',
	// 使用路由对象实例
	router:router1,
	// render:function(create){create(App)} //es5的写法
	render:c=>c(App)  // es6的函数写法 =>：goes to
});